#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<string.h>
int main()
{
    int n = 0;
    scanf("%d", &n);
    while (n--)
    {
        char str[100] = { 0 };
        int flag1 = 0;
        int flag2 = 0;
        int flag3 = 0;
        int flag_error = 0;
        int len = 0;
        scanf("%s", &str);
        len = strlen(str);
        for (int i = 0;i < len;i++)
        {
            if (str[i] < '0' && str[i] > '9' || str[i] < 'A' && str[i] > 'Z' || str[i] < 'a' && str[i] > 'z')
            {
                flag_error = 1;
            }
            if (str[0] >= '0' && str[0] <= '9')
            {
                break;
            }
            if (str[i] >= '0' && str[i] <= '9')
            {
                flag1 = 1;
            }
            if (str[i] >= 'A' && str[i] <= 'Z')
            {
                flag2 = 1;
            }
            if (str[i] >= 'a' && str[i] <= 'z')
            {
                flag3 = 1;
            }
        }
        if (len < 8 || flag_error == 1 || flag1 + flag2 + flag3 <= 1)
        {
            printf("NO\n");
        }
        else
        {
            printf("YES\n");
        }
    }
}